package com.tbit.main.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.tbit.main.constant.enums.ConditionLogic;
import lombok.Data;
import lombok.experimental.FieldNameConstants;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * 绩效规则
 * performance_rule
 */
@Data
@FieldNameConstants
@TableName(value = "performance_rule", autoResultMap = true)
public class PerformanceRule {
    /**
     * 主键
     */
    @TableId(type = IdType.AUTO)
    private Long ruleId;

    /**
     * 所属规则组id
     */
    private Long ruleGroupId;

    /**
     * 绩效系数
     */
    private BigDecimal performance;

    /**
     * 元信息（如：记录优先级）
     */
    @TableField(typeHandler = JacksonTypeHandler.class)
    private Map<String, Object> metaInfo;

    /**
     * 条件逻辑 1-与 2-或
     */
    private ConditionLogic conditionLogic;

    /**
     * 创建时间
     */
    private LocalDateTime createTime;

    /**
     * 规则下条件列表
     */
    @TableField(exist = false)
    private List<PerformanceRuleCondition> conditions = new ArrayList<>();
}